<?php
	require 'connect.php';
	session_start();
	$_SESSION['loginid'] = 'jg';
	if (isset($_SESSION['loginid'])){
		$sql = "select top 2 BillSeq,
					PlacardTitle,PlacardText,
					convert(char(10),PlacardDate,120) as PlacardDate,
					DownLoadURL
				from Placard
				where enable = 1 and Visible = 1
				order by billseq desc";
				
		$rs = odbc_exec($conn,$sql);
		$billInfo=array();
		$i=0; 
		while($row=odbc_fetch_array($rs))
		{
			$row["PlacardTitle"] = iconv("GBK","UTF-8",$row["PlacardTitle"]);
			$row["DownLoadURL"] = iconv("GBK","UTF-8",$row["DownLoadURL"]);
			$row["PlacardText"] = iconv("GBK","UTF-8",$row["PlacardText"]);
			
			$billInfo[$i]=$row; 
	       	$i++;  
		}
		odbc_close($conn);
		echo $_GET['jsoncallback']."(".json_encode($billInfo).")";
	}
				
?>